<template>
  <div v-show="visible" class="dialog-container" @click="maskClick">
    <div class="body" @click.stop="bodyClick">
      <div class="title">
        <span>{{title}}</span>
      </div>
      <div class="context">
        <slot></slot>
      </div>
    </div>
    <!-- <button @click.stop="bodyClick">按钮</button> -->
  </div>
</template>
<script>
export default {
  props: {
    show: Boolean,
    title: {
      default: '标题',
      type: String
    }
  },
  computed: {
    visible() {
      return this.show
    }
  },
  methods: {
    maskClick() {
      // console.log('遮罩点击')
      this.$emit('maskClick')
    },
    bodyClick() {
      // console.log('内容点击')
      // alert('内容点击')
    }
  }
}
</script>
<style lang="scss" scoped>
.dialog-container {
  position: fixed;
  // z-index: 100;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  .body {
    width: 90%;
    border-radius: 0.1rem;
    background-color: #fff;
    .title {
      width: 100%;
      height: 0.59rem;
      background-image: url('../assets/images/popup-title.png');
      background-size: 100% 100%;
      display: flex;
      align-items: center;
      span {
        margin-left: 0.25rem;
        font-size: 0.2rem;
        color: #fff;
      }
    }
    .context {
      width: 100%;
      min-height: 1rem;
      background-color: #fff;
      border-bottom-right-radius: 0.1rem;
      border-bottom-left-radius: 0.1rem;
      font-size: 0.12rem;
    }
  }
}
</style>
